Create Cluster

To form the cluster in TomEE, open the server.xml located in ${catalina.home}/conf directory.

Under the Engine section, have the following configuration:

Configuration

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="6">

<Manager className="org.apache.catalina.ha.session.BackupManager" expireSessionsOnShutdown="false" notifyListenersOnReplication="true" mapSendOptions="6" />

<Channel className="org.apache.catalina.tribes.group.GroupChannel">

<Membership className="org.apache.catalina.tribes.membership.McastService" address="228.0.0.4" port="45564" frequency="500" dropTime="3000" />

<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="auto" port="5000" selectorTimeout="100" maxThreads="6" />

<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">

<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender" /> </Sender>

<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector" />

<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor" />

<Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor" />

</Channel>

<Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=".\.gif|.\.js|.\.jpeg|.\.jpg|.\.png|.\.htm|.\.html|.\.css|.*\.txt" />

<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false" />

<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener" />

</Cluster>

The same configuration needs to be there in other nodes of the cluster environment. Since this is the light weight server and there is no console as of now, in order to have cluster environment, we need to have different servers at various locations with different port numbers.

Change in Data Intake client utility (pas.di.testclient)

  1. Modify conf/CycleClient.properties file in pas.di.testclient with following changes

  2. Uncomment TomEE context factory and comment other context factories

    • contextFactory=org.apache.activemq.jndi.ActiveMQInitialContextFactory

    • provider.url=tcp://localhost:61616 (provide appropriate url ex: Cycle url)

  3. Execute the startup.bat (Windows) and startup.sh (Linux) and select the options.

Configuring Ports

The server.xml should be configured with unique port numbers

Server.xml

<Connector port="8061" protocol="HTTP/1.1"

connectionTimeout="20000"

redirectPort="8443" xpoweredBy="false" server="Apache TomEE" />